package model

import (
	"gorm.io/gorm"
	"time"
)

type Order struct {
	Id        uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserId    uint           `gorm:"column:user_id;type:bigint(20);comment:用户id;not null;" json:"user_id"`                                            // 用户id
	HouseId   uint           `gorm:"column:house_id;type:bigint(20);comment:房源id;not null;" json:"house_id"`                                          // 房源id
	Price     uint           `gorm:"column:price;type:int(10);comment:订单价格;not null;" json:"price"`                                                   // 订单价格
	PayUrl    string         `gorm:"column:pay_url;type:varchar(255);comment:上传凭证;not null;" json:"pay_url"`                                          // 上传凭证
	Status    uint           `gorm:"column:status;type:tinyint(3) UNSIGNED;comment:订单状态:1:待审核，2:签约，3:尾款，4:过户，5:完成;not null;default:1;" json:"status"` // 订单状态:1:待审核，2:签约，3:尾款，4:过户，5:完成
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdetedAt time.Time      `gorm:"column:updeted_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updeted_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (or *Order) TableName() string {
	return "order"
}
